<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Dynamic Table</title>

    <!--dynamic table-->
    <link href="/public/js/advanced-datatable/css/demo_page.css" rel="stylesheet" />
    <link href="/public/js/advanced-datatable/css/demo_table.css" rel="stylesheet" />
    <link rel="stylesheet" href="/public/js/data-tables/DT_bootstrap.css" />
    <?php $this->load->view('library/header');?>
</head>

<body class="sticky-header">

<section>

    <?php $this->load->view('library/left');?>

    <!-- main content start-->
    <div class="main-content" >

        <?php $this->load->view('library/top');?>

        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                订单产品列表
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Dashboard</a>
                </li>
                <li>
                    <a href="#">Data Tables</a>
                </li>
                <li class="active"> Dynamic Table </li>
            </ul>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <div class="wrapper">
            <div class="row">
                <div class="col-sm-12">
                    <?php $this->load->view('library/search');?>
                    <section class="panel">
                        <div class="panel-body">

                            <div class="adv-table">
                                <table  class="display table table-bordered table-striped" id="dynamic-table">
                                    <thead>
                                    <tr>
                                        <th width="3%">产品图片</th>
                                        <th width="5%">货号</th>
                                        <th width="15%">订单号</th>
                                        <th width="10%" class="hidden-phone">订单总价</th>
                                        <th width="10%" class="hidden-phone">属性</th>
                                        <th width="10%" class="hidden-phone">购买数量</th>
                                        <th width="5%" class="hidden-phone">占用数量</th>
                                        <th width="5%" class="hidden-phone">状态</th>
                                        <th width="5%" class="hidden-phone">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php foreach ($goods_list as $item): ?>
                                        <tr class="gradeX">
                                            <td><img width="50px" src="<?php echo $item['original_img'];?>" /></td>
                                            <td><?php echo $item['sku_num_sn'];?></td>
                                            <td><?php echo $item['order_sn'];?></td>
                                            <td class="hidden-phone"><?php echo $item['order_amount'];?></td>
                                            <td class="hidden-phone"><?php echo $item['goods_attr'];?></td>
                                            <td class="hidden-phone"><?php echo $item['goods_number'];?></td>
                                            <td class="center hidden-phone"><?php echo $item['occupy_inventory_num'];?></td>
                                            <td class="center hidden-phone"><?php echo $param_option['status']['option'][$item['status']];?></td>
                                            <td class="hidden-phone">
                                                <a class="btn btn-xs btn-info" href="<?php echo base_url('order/info/order_id/'.$item['order_id']);?>">查看</a>
                                                <?php if ($item['occupy_inventory_num'] > 0 && $item['shipping_status'] == 0):?>
                                                <a class="btn btn-xs btn-info a-ajax" href="<?php echo base_url('order/release_goods_number/rec_id/') . $item['rec_id'];?>">释放库存</a>
                                                <?php endif;?>
                                            </td>
                                        </tr>
                                    <?php endforeach;?>
                                    </tbody>
                                </table>
                            </div>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="dataTables_paginate paging_bootstrap pagination">
                                        <ul>
                                            <?php echo $pages;?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <footer>
            2014 &copy; AdminEx by
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<?php $this->load->view('library/footer');?>

<script type="text/javascript">

    $('.a-ajax').click(function () {

        var url = $(this).attr('href');
		swal({
			title: '释放库存',
			input: 'select',
			inputOptions: {'0':'不采购','1':'重新采购'},
			showCancelButton: true,
			allowOutsideClick: false,
			confirmButtonText: 'Submit',
			inputPlaceholder: '请选择网站',
			preConfirm: function preConfirm(value) {
				return $.post(url, {is_purchase: value}, function (data) {
					return data;
				},'json');
			}
		}).then(function (result) {
			if (result.value) {
				var data = result.value;
				swal({
					type: data.status,
					title: data.info
				}).then(function(isConfirm) {
					location.reload();
				});
			}
		});

        return false;
    });
</script>

<!--common scripts for all pages-->
<script src="/public/js/scripts.js"></script>

</body>
</html>
